package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface WeiboMapper {
    //@Insert("INSERT INTO weibo(content,created,user_id) VALUES(#{content},#{created},#{userId})")
    int insertWeibo(Weibo weibo);

    //@Delete("DELETE FROM weibo WHERE id=#{id}")
    int deleteWeibo(Long id);

   // @Update("UPDATE weibo SET content=#{content},created=#{created},user_id=#{userId} WHERE id=#{id}")
    int updateWeiboById(Weibo weibo);

    //@Select("SELECT id,content,created,user_id userId FROM weibo WHERE id=#{id}")
    Weibo selectWeiboById(Long id);

   // @Select("SELECT id,content,created,user_id userId FROM weibo WHERE user_id=#{uid}")
    List<Weibo> selectWeiboByUserId(Long uid);

   // @Select("SELECT content,created FROM weibo WHERE id=#{id}")
    WeiboVO1 selectWeiboVO1ById(Long id);

    //@Select("SELECT u.username,w.content,w.created FROM user u JOIN weibo w ON u.id=w.user_id WHERE u.id=#{uid1}")
   // @Select("SELECT user.username,weibo.content,weibo.created FROM user,weibo WHERE user.id=weibo.user_id AND user.id=#{uid1}")
    List<WeiboVO2> selectWeiboVO2ById(Long uid1);
    int dynamicUpdate(Weibo weibo);
    int dynamicDelete(ArrayList<Long> ids);
    int dynamicDelete2(Long[] ids);
    int selectCount();
    ResultMapVO1 selectMap1(Long id);
    ResultMapVO2 selectMap2(Long uid);
    ResultMapVO3 selectMap3(Long wid);
    ResultMapVO4 selectMap4(Long wid);
}
